package com.coda.app.mapper;

import com.coda.entity.CityInfo;
import com.coda.entity.DistrictInfo;
import com.coda.entity.ProvinceInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RegionMapper {
    /**
     * 获取省份列表
     * @return
     */
    @Select("select * from province_info")
    List<ProvinceInfo> getProvinceList();

    /**
     *根据省份id查询城市列表
     * @param id
     * @return
     */
    @Select("select * from city_info where province_id = #{id}")
    List<CityInfo> getCityList(Long id);

    /**
     * 根据城市id查询县区列表
     * @param id
     * @return
     */
    @Select("select * from district_info where city_id = #{id}")
    List<DistrictInfo> getDistrictList(Long id);
}
